{% extends 'layout.html' %}

{% block body %}
    <form method="post" action="{{ url_for('exec_sqlite') }}">
        <div class="form-group">
            <label>SQL</label>
            <textarea id="sql" name="sql" rows="5" class="form-control" placeholder="SQL">{% if sql != None %}{{ sql }}{% endif %}</textarea>
        </div>
        <div class="form-group">
           <input type="submit" value="Run">
        </div>
    </form>
    {% if error != None %}
        <div style="height:30px;border-radius: 5px;margin:5px 0px;">
            <p class="bg-danger" style="height:30px;line-height:30px;border-radius:5px;padding:0px 5px;">{{ error }}</p>
        </div>
    {% endif %}
    <div style="width:100%;">
<<<<<<< HEAD
        <table class="table table-border form-class">
            <tr><th>#</th><th>Col0</th></tr>
            {% for r in res %}
                <tr>
{#                    <td>{{ loop.index }}</td>#}
                    {% for c in r %}
                    <td>{{ c }}</td>
                        {% endfor %}
=======
        <table class="table table-border form-class" style="width:100%;">
            <tr><th>#</th>
                {% for c in cols %}
                <th>{{ c }}</th>
                {% endfor %}
            </tr>
            {% for r in res %}
                <tr>
                    <td>{{ loop.index }}</td>
                    {% for c in r %}
                        <td title="{{ c }}">{{ c | clip(20) }}</td>
                    {% endfor %}
>>>>>>> b351df57516c949da68f9d0c2385005e25c1c2c2
                </tr>
            {% endfor %}
        </table>
        <span>{{ msg }}</span>
    </div>
{% endblock %}